<head>
<meta http-equiv='content-type' content='text/html; charset=utf8' />
<title>jsGoo tests</title><link rel='stylesheet' href='main.css' type='text/css' />
<script type='text/javascript' src='jsgoo.js'></script>
<script type='text/javascript'>

var showEdit = function() { 
    showForm(_f.render(DATA.form, 'form1', 'setOther'));
    _f.setValues($('form1'), DATA.sample);
}

var showForm =  function( form ) {
    _.$into('side-content', _.wrap(_.closeLink()+form, 'div class="form"'));
}

var setOther = function(el) { _f.setValues($('form1'), DATA.other); return false; }

//DATA 
var DATA = {
    form: { action: "/update", method: "post",
        fields: {
            name:       { label: "Name",    inp: { type: "text", name: "name" } },
            age:        { label: "Age",     inp: { type: "text", name: "age" } },
            submit:     {                   inp: { type: "submit", value: 'Change', cls: "submit" } }
        }
    },
    sample: { name: "Miha", age: 2.5 },
    other: { name: "Jimmy", age: 30 }
} 
</script>
<body>
<div><a href="index.html">index</a> <a href="#" onclick="showEdit(); return false;">generate</a>
<em>press Change button</em></div>
<div id="side-content"></div>
</body>
</html>
